import {
  sizeOptions,
  inlineOptions,
  labelPositionOptions,
  labelSuffixOptions,
  disabledOptions,
  hideRequiredAsteriskOptions,
  requireAsteriskPositionOptions,
  marks,
  yesOrNoOptions,
  dataSourceTypeOptions,
  methodTypeOptions,
} from '@/schema/config/options'

const useFormConfig = () => {
  const formPropsList = [
    {
      field: 'size',
      label: '尺寸大小',
      component: 'ElSegmented',
      props: { options: sizeOptions },
    },
    {
      field: 'inline',
      label: '行内表单',
      component: 'ElSegmented',
      props: { options: inlineOptions },
    },
    {
      field: 'labelPosition',
      label: '对齐方式',
      component: 'ElSegmented',
      props: { options: labelPositionOptions },
    },
    {
      field: 'labelWidth',
      label: '标签宽度',
      component: 'ElSlider',
      props: {
        min: 0,
        max: 200,
        showStops: true,
        showInput: true,
        marks,
      },
    },
    {
      field: 'labelSuffix',
      label: '标签后缀',
      component: 'ElSegmented',
      props: { options: labelSuffixOptions },
    },
    {
      field: 'disabled',
      label: '表单禁用',
      component: 'ElSegmented',
      props: { options: disabledOptions },
    },
    {
      field: 'hideRequiredAsterisk',
      label: '必填星号',
      component: 'ElSegmented',
      props: { options: hideRequiredAsteriskOptions },
    },
    {
      field: 'requireAsteriskPosition',
      label: '星号位置',
      component: 'ElSegmented',
      props: { options: requireAsteriskPositionOptions },
    },
    {
      field: 'scrollToError',
      label: '滚动到错误位置',
      component: 'ElSegmented',
      props: { options: yesOrNoOptions },
    },
  ]

  const formItemPropsList = [
    {
      field: 'label',
      label: '标签文本',
      component: 'ElInput',
      props: {},
    },
    {
      field: 'size',
      label: '尺寸大小',
      component: 'ElSegmented',
      props: { options: sizeOptions },
    },
    {
      field: 'labelPosition',
      label: '对齐方式',
      component: 'ElSegmented',
      props: { options: labelPositionOptions },
    },
    {
      field: 'labelWidth',
      label: '标签宽度',
      component: 'ElSlider',
      props: {
        min: 0,
        max: 200,
        showStops: true,
        showInput: true,
        marks,
      },
    },
    {
      field: 'required',
      label: '必填',
      component: 'ElSegmented',
      props: { options: yesOrNoOptions },
    },
    {
      field: 'error',
      label: '错误提示',
      component: 'ElInput',
      props: {},
    },
    {
      field: 'showMessage',
      label: '显示错误信息',
      component: 'ElSegmented',
      props: { options: yesOrNoOptions },
    },
    {
      field: 'inlineMessage',
      label: '行内显示错误信息',
      component: 'ElSegmented',
      props: { options: yesOrNoOptions },
    },
  ]

  return {
    formPropsList,
    formItemPropsList,
  }
}

export default useFormConfig
